home *** CD-ROM | disk | FTP | other *** search
/ PC-X 1997 October / pcx14_9710.iso / swag / delphi.swg / 0203_Adding a Stringlist to a Combo Box.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-11-29  |  408 b   |  18 lines

  1. {
  2. I have several combo boxes that I wish to populate at the form creation.
  3. The problem is that I keep getting duplicate values.
  4. }
  5.  
  6. var
  7.  SList : TStringList;
  8. begin
  9.  SList := TStringList.Create;
  10.  SList.sorted := True;
  11.  SLIST.Duplicates := dupIgnore;
  12.  SList.Add('Dog');  {Only one 'Dog' goes in the list}
  13.  SList.Add('cat');
  14.  SList.Add('Dog');
  15.  ComboBox1.Items.Assign(SList);
  16.  SList.free;
  17. end;
  18.